#include <StringListener.h>
#include <QObject>
#include <QString>
#include <QDebug>


StringListener::StringListener(QObject *parent) : QObject(parent), m_string() {}

StringListener::StringListener(const QString &str, QObject *parent) : QObject(parent), m_string(str) {}

StringListener::StringListener(const StringListener &other) : QObject(other.parent()), m_string(other.m_string) {}

StringListener &StringListener::operator=(const QString &other) {
    if (m_string != other) {
        m_string = other;
        emit textChanged(m_string);
    }
    return *this;
}

StringListener &StringListener::operator=(const StringListener &other) {
    if (this != &other) {
        m_string = other.m_string;
        emit textChanged(m_string);
    }
    return *this;
}

QString StringListener::toString() const {
    return m_string;
}
